<%-- 
    Document   : addBooks
    Created on : 30-Mar-2011, 18:00:55
<%--
    Document   : index
    Author     : Thomas
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@ include file="header.jsp" %>

<!-- Content -->

<div id="container">
	<div id="content" role="main">

<div id="post-0" class="post error404 not-found">
    <h1 class="entry-title">Admin</h1>
            <div class="entry-content">

    <h2>Mailing List</h2>
    <form action ="sendMail.jsp" method=post>
        <table>
            <tr<td>Send an e-mail to all users:</td></tr>
            <tr><td>Subject: <input type="text" name="subject" value="" size=25  maxlength=50></td></tr>
            <tr><td colspan="2"><textarea name="body" rows="10" cols="80"></textarea></td></tr>
            <tr><td><div align="center"><input type="submit" value="Send e-mail" ><input type="reset"  value="Clear box"></div></td>
        </table>
    </form>

    <h2>Action Books</h2>

    <!-- Create/Find Database -->
    <%
        bookDatabase_pkg.bookDatabaseDriver driver = new bookDatabase_pkg.bookDatabaseDriver();
        String category = "action";
        int result = driver.createCategoryDB(category);
        if(result == 0){
            out.println("A new database for " + category + " books has been created!<br />");
        }
        else{
            out.println("A database for " + category + " books has been found!<br />");
        }
    %>

    <!-- Form to add book to database -->
    <form>
        <input type="button" id="Add an Action book" value="+ Add an Action book" onclick="removeList('list1', 'Add an Action book')">
    </form>
    <form id="list1" role="addBook" method="get" id="searchform" action="bookAdded.jsp">
	<input type="hidden" value="action" name="category" id="category" />
        ISBN: <input type="text" value="" name="ISBN" id="ISBN" /><br />
        Title: <input type="text" value="" name="title" id="title" /><br />
        Description: <input type="text" value="" name="description" id="description" /><br />
        Price: <input type="text" value="" name="price" id="price" /><br />
        <input type="submit" id="searchsubmit" value="OK" />
    </form>
    <script type="text/javascript">
	document.getElementById('list1').style.display="none";
    </script>

    <!-- Form to delete database -->
    <form role="deleteDB" method="get" id="searchform" action="deleteDB.jsp">
	<input type="hidden" value="action" name="category" id="category" />
        <input type="submit" id="searchsubmit" value="Delete Action Database" />
    </form>
    <hr/>

    <h2>Drama Books</h2>

    <!-- Create/Find Database -->
    <%
        category = "drama";
        result = driver.createCategoryDB(category);
        if(result == 0){
            out.println("A new database for " + category + " books has been created!<br />");
        }
        else{
            out.println("A database for " + category + " books has been found!<br />");
        }
    %>

    <!-- Form to add book to database -->
    <form>
        <input type="button" id="Add a Drama book" value="+ Add a Drama book" onclick="removeList('list2', 'Add a Drama book')">
    </form>
    <form id="list2" role="addBook" method="get" id="searchform" action="bookAdded.jsp">
	<input type="hidden" value="drama" name="category" id="category" />
        ISBN: <input type="text" value="" name="ISBN" id="ISBN" /><br />
        Title: <input type="text" value="" name="title" id="title" /><br />
        Description: <input type="text" value="" name="description" id="description" /><br />
        Price: <input type="text" value="" name="price" id="price" /><br />
        <input type="submit" id="searchsubmit" value="OK" />
    </form>
    <script type="text/javascript">
	document.getElementById('list2').style.display="none";
    </script>

    <!-- Form to delete database -->
    <form role="deleteDB" method="get" id="searchform" action="deleteDB.jsp">
	<input type="hidden" value="drama" name="category" id="category" />
        <input type="submit" id="searchsubmit" value="Delete Drama Database" />
    </form>
    <hr/>
        
    <h2>Comedy Books</h2>

    <!-- Create/Find Database -->
    <%
        category = "comedy";
        result = driver.createCategoryDB(category);
        if(result == 0){
            out.println("A new database for " + category + " books has been created!<br />");
        }
        else{
            out.println("A database for " + category + " books has been found!<br />");
        }
    %>

    <!-- Form to add book to database -->
    <form>
        <input type="button" id="Add a Comedy book" value="+ Add a Comedy book" onclick="removeList('list3', 'Add a Comedy book')">
    </form>
    <form id="list3" role="addBook" method="get" id="searchform" action="bookAdded.jsp">
	<input type="hidden" value="comedy" name="category" id="category" />
        ISBN: <input type="text" value="" name="ISBN" id="ISBN" /><br />
        Title: <input type="text" value="" name="title" id="title" /><br />
        Description: <input type="text" value="" name="description" id="description" /><br />
        Price: <input type="text" value="" name="price" id="price" /><br />
        <input type="submit" id="searchsubmit" value="OK" />
    </form>
    <script type="text/javascript">
	document.getElementById('list3').style.display="none";
    </script>

    <!-- Form to delete database -->
    <form role="deleteDB" method="get" id="searchform" action="deleteDB.jsp">
        <input type="hidden" value="comedy" name="category" id="category" />
        <input type="submit" id="searchsubmit" value="Delete Comedy Database" />
    </form>
    <hr/>

        </div><!-- .entry-content -->
</div><!-- #post-0 -->

	</div><!-- #content -->
</div><!-- #container -->

<%@ include file="sidebar.jsp" %>

<!-- /Content -->

<%@ include file="footer.jsp" %>
